<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>浏览历史</title>
</head>

<body>

</body>
<script src="js/jquery.js"></script>
<script src="js/template.js"></script>
<script id="template" type="text/html">
    {{each data as val i}}
        <li>{{val.content}}{{val.id}}</li>
    {{/each}}
</script>
<script type="text/javascript">
    var historyarray = JSON.parse(window.localStorage.getItem("history_list"));
    var data = {
        history_list: historyarray
    };
    console.log(historyarray.toString());

    // console.log(getCookie('id'));
    // if (getCookie('id') != '') {

    // }
    $.get('/users/history', data, function (resData) {
    
        console.log(resData);
        var htmlStr = template('template',resData);
        console.log(htmlStr);
		document.body.innerHTML = htmlStr;
        // console.log(resData.message);

    });

    // function getCookie(c_name) {
    //     if (document.cookie.length > 0) {
    //         c_start = document.cookie.indexOf(c_name + "=");
    //         if (c_start != -1) {
    //             c_start = c_start + c_name.length + 1
    //             c_end = document.cookie.indexOf(";", c_start)
    //             if (c_end == -1) c_end = document.cookie.length
    //             return unescape(document.cookie.substring(c_start, c_end))
    //         }
    //     }
    //     return ""
    // }
</script>

</html>